package com.java.tutorials.Class.anonymous;

/**
 * Created by xuzhike on 2016/3/14.
 * http://www.java2s.com/Code/Java/Class/anexampleofasimpleanonymousclass.htm
 an example of a simple anonymous class
 */
public class MainClass {
    public static void main(String[] args) {
        Ball b = new Ball() {
            public void hit() {
                System.out.println("You hit it!");
            }
        };
        b.hit();
    }

    interface Ball {
        void hit();
    }
}
